/**
 * Created by apple on 2016/12/6.
 */

exports.LoginSession = function (req, res, user) {
    return req.session.user = {
        id: user.id,
        name: user.name
    }
};

exports.logoutSession = function (req) {
    return delete req.session.user;
};

exports.adminLoginSession = function (req, res, admin) {
    return req.session.admin = {
        id: admin.id,
        name:admin.name
    }
};

exports.adminLogoutSession = function (req) {
    return delete req.session.admin;
};

exports.locationSession = function (req, res, pid, cid, aid) {
    return req.session.location = {
        pid: pid,
        cid:cid,
        aid:aid
    }
};

exports.departmentSession = function (req, res, hp, list_dept_f, list_dept_s, f_id, s_id) {
    return req.session.department = {
        hospital: hp,
        list_dept_f: list_dept_f,
        list_dept_s: list_dept_s,
        first_level: f_id,
        second_level: s_id
    }
};

exports.deptSession = function (req, res, fid, sid, dl) {
    return req.session.dept = {
        first_level:fid,
        second_level:sid,
        d_level:dl
    }
};